//
//  CaseEntrustListTableViewCell.m
//  yonghu
//
//  Created by 浪尖渝力 on 2018/1/19.
//  Copyright © 2018年 com.DJS. All rights reserved.
//

#import "CaseEntrustListTableViewCell.h"

@implementation CaseEntrustListTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)creatView{
    self.backgroundColor=_LightGrey;
    UIView *beiJinView=[UIView new];
    [self addSubview:beiJinView];
    [beiJinView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.right.mas_equalTo(-5);
        make.top.mas_equalTo(7);
        make.bottom.mas_equalTo(0);
    }];
    beiJinView.backgroundColor=[UIColor whiteColor];
    beiJinView.layer.cornerRadius=3;
    
    UIImageView *iamgeView=[UIImageView new];
    [beiJinView addSubview:iamgeView];
    [iamgeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.height.mas_equalTo(60);
    }];
    iamgeView.layer.cornerRadius=30;
    iamgeView.layer.masksToBounds=YES;
    NSString *news_cover=[_tableDic objectForKey:@"user_icon"];
    news_cover=[NSString stringWithFormat:@"%@%@",_addressUrl,news_cover];
    [iamgeView sd_setImageWithURL:[NSURL URLWithString:news_cover]];
    
    NSString *phoneStr=[_tableDic objectForKey:@"user_nickname"];
    UILabel *label=[UILabel new];
    [beiJinView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iamgeView.mas_right).mas_equalTo(6);
        make.top.mas_equalTo(iamgeView);
        make.right.mas_equalTo(-120);
    }];
    label.text=phoneStr;
    label.textColor=ColorWithRGB(49, 49, 49);
    label.font=[UIFont systemFontOfSize:17];
    
    NSNumber *time=[_tableDic objectForKey:@"litigation_time"];
    UILabel *timeLabel=[UILabel new];
    [beiJinView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(label);
        make.bottom.mas_equalTo(iamgeView);
    }];
    timeLabel.text=[ZQTools changeTimeCuo:@"YYYY-MM-dd HH:mm:ss" :[NSString stringWithFormat:@"%@",time]];;
    timeLabel.font=[UIFont systemFontOfSize:14];
    timeLabel.textColor=ColorWithRGB(149, 149, 149);
    
    NSNumber *consult_status=[_tableDic objectForKey:@"litigation_status"];
    UILabel *statusLabel=[UILabel new];
    [beiJinView addSubview:statusLabel];
    [statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(iamgeView);
    }];
    statusLabel.textColor=ColorWithRGB(109, 179, 223);
    statusLabel.font=[UIFont systemFontOfSize:16];
    if (consult_status.intValue==2) {
        NSNumber *litigation_send_status=[_tableDic objectForKey:@"litigation_send_status"];
        if (litigation_send_status.integerValue==2) {
            statusLabel.text=@"进行中";
        }
        else{
             statusLabel.text=@"待接受";
        }
       
    }  if (consult_status.intValue==3) {
        statusLabel.text=@"进行中";
    }  if (consult_status.intValue==4||consult_status.intValue==4) {
        statusLabel.text=@"已完成";
    }
    
    NSString *consult_ct_name=[_tableDic objectForKey:@"litigation_ct_name"];
    CGSize size=[ZQTools getNSStringWeight:consult_ct_name andViewWight:20 andFont:18];
    UILabel *ct_nameLabel=[UILabel new];
    [beiJinView addSubview:ct_nameLabel];
    [ct_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(timeLabel);
        make.height.mas_equalTo(30);
        make.top.mas_equalTo(timeLabel.mas_bottom).mas_equalTo(15);
        make.width.mas_equalTo(size.width+14);
    }];
    ct_nameLabel.text=consult_ct_name;
    ct_nameLabel.font=[UIFont systemFontOfSize:16];
    ct_nameLabel.backgroundColor=[UIColor grayColor];
    ct_nameLabel.textColor=[UIColor whiteColor];
    [ct_nameLabel layoutIfNeeded];
    ct_nameLabel.textAlignment=NSTextAlignmentCenter;
    ct_nameLabel.layer.cornerRadius=4;
    
    NSNumber *consult_money=[_tableDic objectForKey:@"litigation_money"];
    UILabel *moneyLabel=[UILabel new];
    [beiJinView addSubview:moneyLabel];
    [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(ct_nameLabel.mas_right).mas_equalTo(20);
        make.centerY.mas_equalTo(ct_nameLabel);
    }];
    if ([consult_money isKindOfClass:[NSNull class]]) {
        consult_money=@0;
    }
    moneyLabel.text=[NSString stringWithFormat:@"¥%@/份",consult_money];
    moneyLabel.textColor=[UIColor redColor];
    moneyLabel.font=[UIFont systemFontOfSize:14];
    
//    UILabel *contLable=[UILabel new];
//    [self addSubview:contLable];
//    [contLable mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.mas_equalTo(iamgeView);
//        make.right.mas_equalTo(statusLabel);
//        make.top.mas_equalTo(ct_nameLabel.mas_bottom).mas_equalTo(20);
//    }];
//    contLable.numberOfLines=2;
//    contLable.textColor=ColorWithRGB(79, 79, 79);
//    contLable.text=[_tableDic objectForKey:@"document_content"];
//    contLable.font=[UIFont systemFontOfSize:17];
}

@end
